package org.his.service.impl;

import java.util.List;

import org.his.entity.Drug;
import org.his.mapper.DrugMapper;
import org.his.mapper.LoginMapper;
import org.his.service.DrugService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class DrugServiceImpl implements DrugService {

	@Autowired
	private DrugMapper drugMapper;

	public List<Drug> queryAllDrugs() {
		return drugMapper.queryAllDrugs();
	}

	public List<Drug> queryByFrom(Drug qDrug) {

//		if (qDrug.getDrugname() == null && qDrug.getDrugno() == null) {
//			return drugMapper.queryByFrom(qDrug);
//		} else {
//			return drugMapper.queryAllDrugs();
//		}
		return drugMapper.queryByFrom(qDrug);
	

	}

	public int addDrug(Drug addDrug) {
		int count = drugMapper.addDrug(addDrug);
		return count;
	}
	
	public int deleteDrug(String drugno) {
		int count = drugMapper.deleteDrug(drugno);
		return count;
	}

	public int updateDrug(Drug uDrug) {
		int count = drugMapper.updateDrug(uDrug);
		return count;
	}

	public List<Drug> queryList(String q) {
		
		return drugMapper.queryList(q);
	}

}
